<template>
    <view class="text-white">
		<cu-custom bgColor="nav-bg-blue" :isBack="true">
			<block slot="content"> 
				地图
			</block>
		</cu-custom>
        <view class="page-body">
            <view class="page-section page-section-gap">
                <map style="width: 100%;height: 100vh;" scale="12" :latitude="latitude" :longitude="longitude" :markers="covers" :polyline="polyline">
                </map>
            </view>
        </view>
    </view>
</template>

<script>
	import {mapState} from 'vuex'
	export default {
	    data() {
	        return {
				id:0, // 使用 marker点击事件 需要填写id
	            title: 'map',
	            latitude: 0,
	            longitude: 0,
	            covers: [],
				polyline: []
	        }
	    },
		computed:{
			...mapState(['position']),
		},
		onLoad(option) {
			let polyline = option.polyline
			let site = JSON.parse(option.site)
			polyline = polyline.split(';')
			this.latitude = this.position.lat
			this.longitude = this.position.lng
			let lines = []
			polyline.forEach(function(item,index){
				let items = item.split(',')
				lines.push({
					longitude: items[0],
					latitude: items[1]
				})
			})
			this.covers = site
			this.polyline = [{
				points: lines,
				color: "#0091ff",
				width: 6,
				arrowLine: true
			}]
		},
	    methods: {
	
	    }
	}
</script>

<style>
</style>
